package com.chare.Controller;


import com.chare.pojo.Department;
import com.chare.pojo.RespBean;
import com.chare.service.IDepartmentService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author shi
 * @since 2022-06-17
 */
@RestController
@RequestMapping("/system/basic/department")
public class DepartmentController {
    @Autowired
    private IDepartmentService departmentService;

@ApiModelProperty("获取所有部门")
@GetMapping("/")
public List<Department> getAll()
{
return  departmentService.getAll();
}
@ApiModelProperty("添加部门")
    @PostMapping("/")
public RespBean addDep(@RequestBody Department department)
{
   return departmentService.addDep(department);
}
@ApiModelProperty("删除部门")
    @DeleteMapping("/{id}")
    public RespBean deleteDe(@PathVariable Integer id)
{
 return    departmentService.deleteDe(id);
}
}
